<%@ page import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path=request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台管理系统HTML模板--我爱模板网 www.5imoban.net</title>
<link href="<%=basePath %>styles/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=basePath %>js/jquery.js"></script>



<script type="text/javascript">
$(document).ready(function(){
   $(".click").click(function(){
  
	  var ch = $(this).text();//点击控件上的文本，判断用户操作
	  var ids = BBB('ck');//得到所有选中的数据项
	  
	  
	  if(ch=="添加新闻"){
	  	  $("#errorText").text("");
	  	  $("#txtTitle").val("请填写新闻标题");
	  	  $("#txtUrl").val("请填写新闻地址");
	  	  $(".tip2").fadeIn(200);
	      return;
	  }
	  
	  if(ids==""){
	  	alert('请选择要修改的数据');
	  }else{
	  	//document.getElementById('vk').innerText=ids;
	  	$("#vk").text(ids);
	  	$(".tiptop span").text(ch);//类tiptop控件中的嵌套标签span中的文本修改
	  	$(".tip").fadeIn(200);
	  }
  
  });
  
  $(".tiptop a").click(function(){
  $(".tip").fadeOut(200);
  });

  $(".sure").click(function(){
  
	  var ch = $(".tiptop span").text();
	  var ids = $("#vk").text();
	  if(ch=="批量审核"){
	  	document.location="news?type=sh&id="+ids;
	  }else if(ch=="批量删除"){
	  	document.location="news?type=sc&id="+ids;
	  }
	  $(".tip").fadeOut(100);
});

  $(".cancel").click(function(){
  $(".tip").fadeOut(100);
  });
  
  $(".tiptop2 a").click(function(){
  $(".tip2").fadeOut(200);
  });
  $("#qx").click(function(){
  $(".tip2").fadeOut(100);
  });
  $("#txtTitle").click(function(){
  
  
  	
  });
  
  $("#fb").click(function(){
    var s1 = $("#topicName").val();
  	
  	if(s1 == ""){
  		$("#errorText").text("请填写栏目名称");
  	}
    else{
  		document.forms[0].submit();
  	}
  		
  	
  	
  });
});
</script>
<script src="<%=basePath %>js/a.js"></script>

</head>


<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">数据表</a></li>
    <li><a href="#">基本内容</a></li>
    </ul>
    </div>
    
    <div class="rightinfo">
    
    <div class="tools">
    
    	<ul class="toolbar">
	        <li class="click"><span><img src="<%=basePath %>images/t01.png" /></span>添加新闻</li>
	        <li class="click"><span><img src="<%=basePath %>images/t02.png" /></span>批量审核</li>
	        <li class="click"><span><img src="<%=basePath %>images/t03.png" /></span>批量删除</li>
	        <li><span><img src="<%=basePath %>images/t04.png" /></span>统计</li>
        </ul>
        
        
        <ul class="toolbar1">
        <li><span><img src="<%=basePath %>images/t05.png" /></span>设置</li>
        </ul>
    
    </div>
    
    
    <table class="tablelist">
    	<thead>
    	<tr>
        <th><input name="" type="checkbox" value="" onclick="AAA('ck')"/></th>
        <th>编号<i class="sort"><img src="<%=basePath %>images/px.gif" /></i></th>
        <th>栏目名称</th>
        <th>新闻</th>
        <th>IP</th>
        <th>发布时间</th>
        <th>是否审核</th>
        <th>操作</th>
        </tr>
        </thead>
        <tbody>
	
		<c:forEach items="${topic_list}" var="currTopic" varStatus="t">
        <tr>
        <td><input name="ck" type="checkbox" value="" /></td>
        <td></td>
        <td><c:out value="${currTopic.topicName }" /></td>  	
        <td>
        <ul>
        <c:forEach items="${currTopic.news}" var="currNews" varStatus="nt">
        <li>
        <c:out value="${currNews.newsTitle }"/>
        </li>
        </c:forEach>
        </ul>
        </td>
        <td></td>
        <td></td>
        
        <td>
	        
	         
         </td>
        
        
        
        <td>
        	<a href="news?type=sh&id=" class="tablelink"> 审核</a>
        	<a href="news?type=xg&id=" class="tablelink"> 修改</a>
        	<a href="news?type=sc&id=" class="tablelink"> 删除</a>
        </td>
        </tr> 
  		</c:forEach>
        </tbody>
    </table>
   
   
    <div class="pagin">
    	<div class="message">共<i class="blue"></i>条记录，当前显示第&nbsp;<i class="blue">&nbsp;</i>页</div>
        <ul class="paginList">
        <li class="paginItem"><a href="news?pageNum="><span class="pagepre"></span></a></li>
        
        
        
        <li class="paginItem">
        	<a href="news?pageNum="></a>
        </li>
        
        
        
        <li class="paginItem"><a href="news?pageNum"><span class="pagenxt"></span></a></li>
        </ul>
    </div>
    
    
    <div class="tip">
    	<div class="tiptop"><span>提示信息</span><a></a></div>
        
      <div class="tipinfo">
        <span><img src="<%=basePath %>images/ticon.png" /></span>
        <div class="tipright">
        <p>是否确认对信息的修改 ？</p>
        <cite id="vk">如果是请点击确定按钮 ，否则请点取消。</cite>
        </div>
        </div>
        
        <div class="tipbtn">
        <input name="" type="button"  class="sure" value="确定" />&nbsp;
        <input name="" type="button"  class="cancel" value="取消" />
        </div>
    
    </div>
    <div class="tip2">
    		<div class="tiptop2"><span>添加栏目</span><a></a></div>
			<div class="formbody">
				<div id="usual1" class="usual">
					<div id="tab1" class="tabson">

						<div class="formtext">
							Hi，
							<b></b>，欢迎您试用新闻发布功能！
						</div>
						<!-- commandName属性和控制器中的Model是不是有什么关系？
						form标签没有action属性，如何知道数据提交到哪里？ -->
						<form:form commandName="topic_command" method="POST">
						<ul class="forminfo">
							<li>
								<label>
									栏目名称
									<b>*</b>
								</label>
								<!-- path属性与什么有关系？ -->
								<form:input path="topicName" class="dfinput"
									style="width: 518px;" />
							</li>
							
							<li><label style="width: 518px;"><b id="errorText"></b></label></li>
							
							<li><label>&nbsp;</label><input id="fb" name="" type="button" class="btn" value="马上发布" />&nbsp;&nbsp;&nbsp;&nbsp;<input id="qx" type="button" class="btn" value="取消" /></li></ul>
					    </form:form>
						
						<!-- <form action="<%=basePath %>newsmanage/doaddnews" method="post">
						<ul class="forminfo">
							<li>
								<label>
									新闻标题
									<b>*</b>
								</label>
								<input id="txtTitle" name="txtTitle" type="text" class="dfinput" value="请填写新闻标题"
									style="width: 518px;" />
							</li>
							<li>
								<label>
									新闻链接
									<b>*</b>
								</label>
								<input id="txtUrl" name="txtUrl" type="text" class="dfinput" value="请填写新闻地址"
									style="width: 518px;" />
							</li>
							<li><label style="width: 518px;"><b id="errorText"></b></label></li>
							
							<li><label>&nbsp;</label><input id="fb" name="" type="button" class="btn" value="马上发布" />&nbsp;&nbsp;&nbsp;&nbsp;<input id="qx" type="button" class="btn" value="取消" /></li></ul>
					    </form>
					     -->
					</div>
				</div>
			</div>
	</div>


		</div>
    
    <script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
	</script>
</body>
</html>
